Luxy VWAP Magic - MTF Projection EngineThis indicator transforms the classic VWAP into a comprehensive trading system. Instead of switching between multiple indicators, you get everything in one place: multi-timeframe analysis, statistical bands, momentum detection, volume profiling, session tracking, and divergence signals.
What Makes This Different
Traditional VWAP indicators show a single line. This tool treats VWAP as a foundation for complete market analysis. The indicator automatically detects your asset type (stocks, crypto, forex, futures) and adjusts its behavior accordingly. Crypto traders get 24/7 session tracking. Stock traders get proper market hours handling. Everyone gets institutional-grade analytics.
Anchor Period Options
The anchor period determines when VWAP resets and recalculates. You have three categories of options:
Time-Based Anchors:
Session - Resets at market open. Best for intraday stock trading where you want fresh VWAP each day.
Day - Resets at midnight UTC. Standard option for most traders.
Week / Month / Quarter / Year - Longer reset periods for swing traders and position traders who want broader context.
Rolling Window Anchors:
Rolling 5D - A sliding 5-day window that never resets. Solves the Monday problem where weekly VWAP equals daily VWAP on first day of week.
Rolling 21D - Approximately one month of trading data in continuous calculation. Excellent for crypto and forex markets that trade 24/7 without clear session breaks.
Event-Based Anchors:
Dividends - Resets on ex-dividend dates. Track institutional cost basis from dividend events.
Splits - Resets on stock split dates. Useful for analyzing post-split trading behavior.
Earnings - Resets on earnings report dates. See where volume-weighted trading occurred since last quarterly report.
Standard Deviation Bands
Three sets of bands surround the main VWAP line:
Band 1 (Aqua) - Plus and minus one standard deviation. Approximately 68% of price action occurs within this range under normal distribution. Touches suggest minor extension.
Band 2 (Fuchsia) - Plus and minus two standard deviations. Only 5% of trading should occur outside this range statistically. Touches here indicate significant overextension and high probability of mean reversion.
Band 3 (Purple) - Plus and minus three standard deviations. Touches are rare (0.3% probability) and represent extreme conditions. Often marks climax moves or panic selling/buying.
Each band can be toggled independently. Most traders show Band 1 by default and add Band 2 and 3 for specific setups or volatile instruments.
Multi-Timeframe VWAP System
The MTF section plots previous period VWAPs as horizontal support and resistance levels:
Daily VWAP - Previous day's final VWAP value. Key intraday reference level.
Weekly VWAP - Previous week's final VWAP. Important for swing traders.
Monthly VWAP - Previous month's final VWAP. Institutional benchmark level.
Quarterly VWAP - Previous quarter's final VWAP. Major support/resistance for position traders.
Previous Day VWAP - Yesterday's closing VWAP specifically, separate from current daily calculation.
The Confluence Zone percentage setting determines how close multiple VWAPs must be to trigger a confluence alert. When two or more timeframe VWAPs converge within this threshold, you get a high-probability support/resistance zone.
Session VWAPs for Global Markets
For forex, crypto, and futures traders who operate in 24/7 markets, the indicator tracks three major global sessions:
Asia Session - UTC 21:00 to 08:00. Gold colored line. Typically lower volatility, range-bound action that sets overnight levels.
London Session - UTC 08:00 to 17:00. Orange colored line. Often determines daily direction with high volume European participation.
New York Session - UTC 13:00 to 22:00. Blue colored line. Highest volume session globally. Sharp directional moves common.
Previous session VWAP values display as horizontal lines when each session closes, acting as intraday support and resistance. The table shows which sessions are currently active with checkmarks.
On-Chart Labels and Signals
The indicator plots several types of labels directly on price action when significant events occur:
Volume Spike Labels
Fire when current bar volume exceeds configurable thresholds relative to both the previous bar and the 20-bar average. Default settings require 300% of previous bar AND 200% of average volume. Green labels indicate bullish candles. Red labels indicate bearish candles. These spikes often mark institutional entry points.
Momentum Shift Labels
Appear when VWAP acceleration changes direction. The Slowing label warns when an active trend loses steam, often preceding reversal. The Accelerating label confirms trend continuation or potential bottom during downtrends. Filters available to show only reversal signals in existing trends.
VWAP Squeeze Labels
Detect when standard deviation bands contract relative to ATR (Average True Range). Low volatility compression often precedes explosive breakout moves. When the squeeze fires (releases), a label appears with directional prediction based on VWAP slope.
Divergence Labels
Mark price/volume divergences using CVD (Cumulative Volume Delta) analysis:
Bullish divergence: Price makes lower low, but CVD makes higher low. Hidden accumulation despite price weakness.
Bearish divergence: Price makes higher high, but CVD makes lower high. Hidden distribution despite price strength.
Dynamic VWAP Coloring
The main VWAP line changes color based on its slope direction:
Green - VWAP is rising. Institutional buying pressure. Volume-weighted price increasing.
Red - VWAP is falling. Institutional selling pressure. Volume-weighted price decreasing.
Gray - VWAP is flat. Consolidation or balance between buyers and sellers.
This coloring can be disabled for a static blue line if you prefer cleaner visuals. The VWAP label next to the line shows the current trend direction and delta percentage.
Calculated Projection Cone
One of the most powerful features is the Calculated Projection Cone. Unlike traditional extrapolation methods that simply extend a trend line forward, this system analyzes what actually happened in similar market conditions throughout the chart's history.
How It Works:
The system classifies each bar into one of 27 unique market states:
Z-Score Level - LOW (oversold), MID (fair value), or HIGH (overbought) based on configurable thresholds
Trend Direction - DOWN, FLAT, or UP based on VWAP slope
Volume Profile - LOW (below 80%), NORMAL (80-150%), or HIGH (above 150%) relative volume
When you look at the current bar, the indicator:
1. Identifies the current market state (e.g., LOW Z-Score + UP Trend + HIGH Volume)
2. Searches through all historical bars on the chart that had the same state
3. Calculates what happened in those bars X bars later (where X is your projection horizon)
4. Shows you the probability of up/down and the average move size
Visual Elements:
Probability Cone - Colored green (bullish probability above 55%), red (bearish below 45%), or gold (neutral). The cone width represents the historical range of outcomes (roughly the 20th to 80th percentile).
Center Line - Shows the average expected price based on historical outcomes in similar conditions.
Probability Label - Displays direction probability and average move. Example: "67% UP (+0.8%)" means 67% of similar past cases moved up, averaging 0.8% gain.
Fallback System:
When the exact 27-state match has insufficient historical data:
First fallback: Uses Z-Score plus Trend only (9 broader states, ignoring volume)
Second fallback: Uses Z-Score only (3 states)
When fallback is active, confidence automatically adjusts
Settings:
Projection Horizon - How many bars forward to analyze outcomes (5, 10, 15, or 20 bars, default 10)
Lookback Period - Historical data window in days (30-252, default 60)
Minimum Samples - Cases needed before using fallback (5-30, default 10)
Z-Score Threshold - Bucket boundary for LOW/MID/HIGH classification (1.0, 1.5, or 2.0 sigma)
Cloud Transparency - Adjust visibility (50-95%)
Colors - Customize bullish, bearish, and neutral cone colors
Confidence Levels:
HIGH - 30 or more similar historical cases found
MEDIUM - 15-29 similar cases
LOW - Fewer than 15 cases (more uncertainty)
IMPORTANT DISCLAIMER:
The Calculated Projection is based on past patterns only. It is NOT a price prediction or financial advice. Similar market states in the past do not guarantee similar outcomes in the future. The probability shown is historical frequency, not a guarantee. Always combine with other analysis and never rely solely on projections for trading decisions.
Alert Conditions
The indicator includes over 20 pre-built alert conditions:
Price vs VWAP:
Price crosses above VWAP
Price crosses below VWAP
Band Touches:
Price touches plus or minus one sigma band
Price touches plus or minus two sigma band (extreme)
Price touches plus or minus three sigma band (very extreme)
Z-Score Extremes:
Z-Score crosses above plus two (overbought extreme)
Z-Score crosses below minus two (oversold extreme)
Momentum and Trend:
Momentum slowing
Momentum accelerating
Trend turns bullish/bearish/neutral
Volume:
Volume spike detected
CVD Direction:
Buyers take control
Sellers take control
High Probability Signals:
Bullish reversal signal (oversold plus accelerating momentum)
Bearish reversal signal (overbought plus slowing momentum)
MTF and Special:
MTF confluence zone entry
VWAP squeeze fired
Bullish/Bearish divergence detected
Any significant signal (catch-all)
All signals use confirmed bar data to prevent false alerts from incomplete candles.
Settings Overview
Settings are organized into logical groups:
VWAP Settings
Anchor Period selection
Show/Hide VWAP line
Dynamic coloring toggle
VWAP label visibility
Bands Visibility
Toggle each of three bands independently
Info Table
Show/Hide table
Table position (9 options)
Text size
Volume spike label settings with adjustable thresholds
Momentum label settings with filters
Signal labels limited to 5 most recent (auto-managed)
Probability engine lookback period
Multi-Timeframe VWAP
Enable/Disable MTF system
Show MTF in table
Show MTF lines on chart
Individual timeframe toggles
Confluence zone threshold
Squeeze detection toggle
Session VWAPs
Enable/Disable session tracking
Apply to all assets option
Show session labels
Divergence Detection
Enable/Disable divergence
Pivot lookback period
Show divergence labels
Calculated Projection
Enable/Disable projection cone
Projection horizon (5, 10, 15, or 20 bars)
Lookback period in days (30-252)
Minimum samples threshold
Z-Score classification threshold (1.0, 1.5, or 2.0 sigma)
Cloud transparency adjustment
Bullish, bearish, and neutral colors
The Info Table - Your Trading Dashboard
The right side of your chart displays a compact table with up to twelve metrics.
Row-by-Row Breakdown:
Asset and Period - Shows what the indicator detected (US Stock, Crypto, Forex, etc.) and your selected anchor period. The detection happens automatically based on exchange data, so VWAP resets and calculations match your actual trading instrument.
Delta Percentage - How far current price sits from VWAP, expressed as a percentage. Positive means price trades above fair value. Negative means below. Large delta values (beyond 1-2%) often precede mean reversion moves. Day traders watch this for overextension.
Z-Score - Statistical deviation from VWAP measured in standard deviations. Unlike raw delta, Z-Score accounts for volatility. A 2% move in a volatile biotech stock differs from 2% in a stable utility. Z-Score normalizes this. Values beyond plus or minus two sigma occur only 5% of the time statistically.
Trend Direction - Whether VWAP itself is rising, falling, or flat. Rising VWAP means the volume-weighted average price is increasing, which indicates institutional accumulation. Falling VWAP suggests distribution. This differs from price trend since it weights by volume.
Momentum State - Is the trend accelerating or slowing down? This measures the rate of change in VWAP slope. When an uptrend shows slowing momentum, it often precedes reversal. Accelerating momentum in a downtrend can signal capitulation and potential bottom.
Relative Volume - Current bar volume compared to the 20-bar average, shown as percentage. Values above 150% indicate above-average activity. Spikes above 200-300% often mark institutional involvement. Low volume (below 80%) warns of potential fake moves.
MTF Bias - Four checkmarks or X marks showing whether price sits above or below Daily, Weekly, Monthly, and Quarterly VWAP. Four checkmarks means strong bullish alignment across all timeframes. Four X marks indicates bearish alignment. Mixed readings suggest consolidation or transition.
Band Probabilities - Historical statistics showing how often price touched each standard deviation band over your lookback period. This helps you understand if mean reversion or trend following works better for your specific instrument.
Session Status - Which global trading sessions are currently active (Asia, London, New York). Shows checkmarks for active sessions. Important for forex and crypto traders who need to know when major liquidity windows open and close.
Divergence State - Whether the indicator detects bullish or bearish divergence between price and cumulative volume delta. Bullish divergence occurs when price makes lower lows but buying pressure (CVD) makes higher lows, suggesting hidden accumulation.
Confidence Score - A weighted composite of all factors displayed as a progress bar and percentage. Combines MTF alignment, Z-Score, trend direction, volume delta, momentum, and relative volume into a single 0-100 score. Higher scores indicate stronger conviction setups.
Calculated Projection - When the Projection Cone is enabled, shows the historical probability of price direction and expected move. For example: "▲ 67% (+0.8%)" means in similar market states historically, price moved up 67% of the time with an average gain of 0.8%. The system analyzes 27 unique market states based on Z-Score, Trend, and Volume conditions.
Recommended Use Cases
Day Trading Stocks:
Use Session anchor with Band 1 visible. Watch for price returning to VWAP after morning move. Volume spikes near VWAP often mark institutional accumulation zones.
Swing Trading:
Use Weekly or Rolling 21D anchor. Enable MTF lines for Daily and Weekly levels. Trade pullbacks to these levels in direction of MTF bias.
Crypto and Forex:
Enable Session VWAPs. Use Rolling anchors to avoid artificial resets. Monitor session transitions for breakout opportunities.
Mean Reversion:
Focus on Z-Score reaching plus or minus two. Add Band 2 visibility. Combine with slowing momentum for highest probability reversals.
Trend Following:
Watch MTF bias alignment. Four checkmarks plus accelerating momentum plus high volume confirms trend continuation setups.
Projection Planning:
Enable the Calculated Projection to see what happened historically in similar market conditions. Use 5-10 bars for intraday setups, 15-20 bars for swing trade planning. Focus on high probability readings (above 60%) with HIGH confidence (30 or more samples). The cone shows the probable range of outcomes based on actual historical data. Combine with other factors like MTF alignment and volume for higher conviction setups.
Important Notes
The indicator does not repaint. MTF values use previous period's confirmed data.
Rolling VWAP works best on 15-minute timeframes and above due to bar lookback requirements.
Session VWAPs apply to global markets by default (forex, crypto, futures). Enable the all-assets option for stocks if desired.
Volume data for forex represents tick volume, not actual traded volume.
All alert conditions fire only on confirmed (closed) bars to prevent false signals.
The Calculated Projection updates each bar as market state changes. This is expected behavior. The projection shows probabilities based on similar past conditions, not a fixed prediction.
Q AND A
Q: Does this indicator repaint?
A: No. The main VWAP calculation uses standard TradingView VWAP methodology. Multi-timeframe values use previous period's confirmed data with appropriate lookahead settings. All alert signals require bar confirmation.
Q: Why does my Rolling VWAP look different on 1-minute versus 15-minute charts?
A: Rolling VWAP calculates across a fixed number of trading days. On very short timeframes, the bar lookback may hit TradingView limits. For best Rolling VWAP accuracy, use 15-minute or higher timeframes.
Q: Can I use this on any instrument?
A: Yes. The indicator automatically detects asset type and adjusts behavior. Stocks use standard market hours. Crypto uses 24/7 calculations. Forex uses tick volume. Everything adapts automatically.
Q: What does the Confidence Score actually measure?
A: The score combines six weighted factors: MTF alignment (25%), Z-Score position (20%), Trend direction (20%), CVD pressure (15%), Momentum state (10%), and Relative volume (10%). Higher scores indicate more factors aligned in one direction.
Q: Why are Session VWAPs not showing on my stock chart?
A: Session VWAPs apply to 24-hour markets by default (forex, crypto, futures). For stocks, enable the Use for All Assets option in Session VWAP settings.
Q: The Divergence labels appear delayed. Is this a bug?
A: Divergence detection requires pivot confirmation, which needs bars on both sides of the pivot point. The label appears at the actual pivot location (several bars back) once confirmed. This is intentional and prevents false signals.
Q: Can I change the band colors?
A: Yes. Each of the three bands has its own color input setting. You can customize Band 1, Band 2, and Band 3 colors to match your preferences. The defaults are Aqua, Fuchsia, and Purple. The main VWAP line color adapts dynamically based on slope direction or can be set to static blue.
Q: How do I set up alerts?
A: Right-click on the chart, select Add Alert, choose this indicator, and select your desired condition from the dropdown. All conditions include descriptive alert messages with relevant data.
Q: What is the Probability Engine lookback period?
A: This setting determines how many trading days the indicator analyzes to calculate band touch rates and mean reversion statistics. Default is 60 days (approximately 3 months). Longer periods provide more stable statistics but may miss recent behavior changes.
Q: Why do I see fewer labels than expected?
A: Signal labels (Volume, Momentum, Squeeze, Divergence) are limited to 5 most recent labels on the chart to keep it clean. When a new label appears, the oldest one is automatically removed. Additionally, momentum labels have several filters: check the slope multiplier setting (higher values require stronger trends) and the Only Reversal Signals option (when enabled, labels only appear for potential reversals, not trend confirmations).
Q: What is the Calculated Projection and how accurate is it?
A: The Calculated Projection analyzes what happened in past market conditions similar to the current state. It classifies each bar by Z-Score level, Trend direction, and Volume profile (27 unique states), then shows the historical probability of up vs down and the average move size. It is NOT a price prediction or guarantee. The probability shown is how often similar conditions led to up/down moves historically, not a future guarantee. Always use it as one input among many.
Q: Why does the Projection probability change?
A: The projection updates on each bar as market state changes. If Z-Score moves from LOW to MID, or trend shifts from UP to FLAT, the system looks up a different historical category. This is expected behavior. The projection shows what happened in similar past conditions to the current bar's state.
Q: The Projection shows LOW confidence. What does that mean?
A: Confidence levels indicate sample size: HIGH means 30 or more historical cases found, MEDIUM means 15-29 cases, LOW means fewer than 15 cases. When sample size is low, the system uses a fallback: first aggregating by Z-Score plus Trend only (ignoring volume), then by Z-Score only. LOW confidence means less statistical reliability, so weight other factors more heavily in your decision.
Q: Why does the cone sometimes show 50/50 probability?
A: A 50/50 reading means that in similar past market states, price moved up roughly half the time and down half the time. This indicates a neutral or balanced condition where historical patterns provide no directional edge. Consider waiting for a higher probability setup or using other analysis methods.
CREDITS AND ACKNOWLEDGMENTS
Methodology Foundation:
VWAP (Volume Weighted Average Price) - Standard institutional benchmark calculation, widely used since the 1980s for algorithmic execution and fair value assessment
Standard Deviation Bands - Statistical volatility measurement applying normal distribution principles to price deviation from mean
Z-Score Analysis - Classic statistical normalization technique for comparing values across different volatility regimes
Cumulative Volume Delta (CVD) - Order flow analysis concept measuring aggressive buying versus selling pressure
Concept Integration:
Mean reversion probability engine - Custom historical statistics tracking for band touch rates
Momentum acceleration detection - Second derivative analysis of VWAP slope changes
VWAP Squeeze - Volatility compression concept adapted from TTM Squeeze methodology applied to VWAP bands versus ATR
Confidence scoring system - Weighted composite scoring combining multiple technical factors
Calculated Projection Cone - Probability-based projection using 27-state market classification (Z-Score, Trend, Volume) with historical outcome analysis and weighted fallback system
All calculations use standard public domain formulas and TradingView built-in functions. No proprietary third-party code was used.
For questions, feedback, or feature requests, please comment below or send a private message.
Happy Trading!
Cerca negli script per "volume profile"
Advanced Volume Profile Levels (Working)This indicator is a powerful tool for traders who use volume profile analysis to identify significant price levels. It automatically calculates and plots the three most critical levels derived from volume data—the Point of Control (POC), Value Area High (VAH), and Value Area Low (VAL)—for three different timeframes simultaneously: the previous week, the previous day, and the current, live session.
The primary focus of this indicator is unmatched readability. It features dynamic, floating labels that stay clear of price action, combined with a high-contrast design to ensure you can see these crucial levels at a glance without any visual clutter.
Key Features
Multi-Session Analysis: Gain a complete market perspective by viewing levels from different timeframes on a single chart.
Weekly Levels: Identify the long-term areas of value and control from the prior week's trading activity.
Daily Levels: Pinpoint the most significant levels from the previous day's Regular Trading Hours (9:30 AM - 4:00 PM ET).
Current Session Levels: Track the developing value area and POC in real-time with a dynamic profile that updates with every bar.
Advanced Visuals for Clarity:
Floating Labels: The labels for the weekly and daily levels intelligently "float" on the right side of your chart, moving with the price to ensure they are never obscured by candles.
High-Contrast Design: Labels are designed for maximum readability with solid, opaque backgrounds and an automatic text color (black or white) that provides the best contrast against your chosen level color.
Trailing Current Levels: The labels for the current session neatly trail the most recent price action, providing an intuitive view of intra-day developments.
Comprehensive Customization: Tailor the indicator's appearance to your exact preferences.
Toggle each profile (Weekly, Daily, Current) on or off.
Individually set the color, line style (solid, dashed, dotted), and line width for each set of levels.
Adjust the text size, background transparency, and horizontal offset for all on-chart labels.
Information Hub:
On-Chart Price Labels: Each label clearly displays both the level name and its precise price (e.g., "D-POC: 22068.50").
Corner Table: An optional, clean table in the top-right corner provides a quick summary of all active weekly and daily level values.
Built-in Alerts:
Create alerts directly from the script to be notified whenever the price crosses above or below the weekly or daily Point of Control, helping you stay on top of key market movements.
How to Use
The levels provided by this indicator serve as powerful reference points for market activity:
Point of Control (POC): The price level with the highest traded volume. It acts as a magnet for price and represents the area of "fair value" for that session. Markets often test or revert to the POC.
Value Area High (VAH) & Value Area Low (VAL): These levels define the range where approximately 70% of the session's volume occurred. They are critical support and resistance zones.
Price acceptance above the VAH may signal a bullish breakout.
Price acceptance below the VAL may signal a bearish breakdown.
Rejection at the VAH or VAL often leads to price moving back across the value area towards the POC.
Fibo Levels with Volume Profile and Targets [ChartPrime]The Fib Levels With Volume Profile and Targets (FIVP) is a trading tool designed to provide traders with a unique understanding of price movement and trading volume through the lens of Fibonacci levels. This dynamic indicator merges the concepts of Fibonacci retracement levels with trading volume analytics to offer predictive insights into potential price trajectories.
Features:
1. Fibonacci Levels: The FPI showcases three prominent Fibonacci levels on both sides of the current price, offering an intricate picture of potential support and resistance levels.
2. Support and Resistance Recognition: Harnessing the power of Fibonacci levels, the FPI provides traders with potential areas of support and resistance, aiding in informed decision-making for entries, exits, and stop placements.
3. Customizable Timeframe Settings: In order to cater to different trading strategies and styles, users can manually select their preferred timeframe for the Fibonacci calculations, ensuring optimal relevance and accuracy for their trading approach.
4. Volume Analytics: One of the standout features of the FIVP is its ability to calculate trading volume for every bar that is sandwiched between the top and lower Fibonacci levels. This ensures traders have a clear vision of where the majority of trading activity is occurring, lending weight to the credibility of the displayed support and resistance zones.
5. Volume-Derived Price Targeting: The Possible Target Arrow function is an innovative feature. By analyzing and comparing the trading volume in the bearish and bullish zones, it provides an arrow indicating the potential direction the market might take. If the bull volume surpasses the bear volume, the market is likely skewing bullish and vice versa.
Usage
Ideal for both novice and seasoned traders, the FPI offers a rich tapestry of information. It allows for refined technical analysis, more precise entries and exits, and a holistic view of the interplay between price and trading volume. Whether you're scalping, day trading, or swing trading, the Fibonacci Profile Indicator is designed to enhance your trading strategy, providing a comprehensive perspective of the market's potential movements.
Prev Day Volume ProfileWhat the script does
Calculates yesterday’s Volume Profile from the bars on your chart (not tick data) and derives:
POC (Point of Control)
VAL (Value Area Low)
VAH (Value Area High)
Draws three horizontal lines for today:
POC in orange
VAL and VAH in purple
Adds labels on the right edge that show the level name and the exact price (e.g., POC 1.2345).
Why it’s bar-based (not tick-based)
Pine Script can’t fetch external tick/aggTrades data. The script approximates a volume profile by distributing each bar’s volume across the price bins that the bar’s high–low range covers. For “yesterday”, this produces a stable, TV-native approximation that’s usually sufficient for intraday trading.
Key inputs
Value Area %: Defaults to 0.70 (70%)—the typical value area range.
TZ Offset vs Exchange (hours): Shifts the day boundary to match your desired session (e.g., Europe/Berlin: +1 winter / +2 summer). This ensures “yesterday” means 00:00–24:00 in your target timezone.
Row Size: Manual? / Manual Row Size: If enabled, you can set the price bin size yourself. Otherwise, the script chooses a TV-like step from syminfo.mintick.
Colors & Line width: POC orange; VAL/VAH purple; configurable width.
My Smart Volume Profile – Fixed
Title: 🔹 My Smart Volume Profile – Fixed
Description:
Lightweight custom Volume Profile showing POC, VAH, and VAL levels from recent bars. Highlights the value area, marks price touches, and supports optional alerts.
Developer Note:
Created with precision and simplicity by Magnergy
My Smart Volume Profile – Fixed
Title: 🔹 My Smart Volume Profile – Fixed
Description:
Lightweight custom Volume Profile showing POC, VAH, and VAL levels from recent bars. Highlights the value area, marks price touches, and supports optional alerts.
Developer Note:
Created with precision and simplicity by Magnergy
My Smart Volume Profile – Fixed
Title: 🔹 My Smart Volume Profile – Fixed
Description:
Lightweight custom Volume Profile showing POC, VAH, and VAL levels from recent bars. Highlights the value area, marks price touches, and supports optional alerts.
Developer Note:
Created with precision and simplicity by Magnergy
Simple Volume Profile with POC (Daily/4H Sessions) [Enhanced]Simple Volume Profile with a Point of Control (POC). The script does the following:
Accumulates volume in user-defined “bins” (price buckets) for a session.
Resets the volume accumulation each new “session”:
On a Daily chart, it considers weekly sessions (resets each Monday).
On a 4H chart, it considers daily sessions (resets at the start of each trading day).
Finds the Point of Control (the price bin with the highest accumulated volume).
Plots the histogram and the POC line on the chart.
Intraday Volume Profile [BigBeluga]The Intraday Volume Profile aims to show delta volume on lower timeframes to spot trapped shorts at the bottom or trapped longs at the top, with buyers pushing the price up at the bottom and sellers at the top acting as resistance.
🔶 FEATURES
The indicator includes the following features:
LTF Delta precision (timeframe)
Sensibility color - adjust gradient color sensitivity
Source - source of the candle to use as the main delta calculation
Color mode - display delta coloring in different ways
🔶 DELTA EXAMPLE
In the image above, we can see how delta is created.
If delta is positive, we know that buyers have control over sellers, while if delta is negative, we know sellers have control over buyers.
Using this data, we can spot interesting trades and identify trapped individuals within the candle.
🔶 HOW TO USE
In the image above, we can see how shorts are trapped at the bottom of the wick (red + at the bottom), leading to a pump also called a "short squeeze."
Same example as before, but with trapped longs (blue + at the top).
This can also work as basic support and resistance, for example, trapped shorts at the bottom with positive delta at the bottom acting as strong support for price.
Users can have the option to also display delta data within the corresponding levels, showing Buyers vs Sellers for more precise trading ideas.
NOTE:
User can only display the most recent data for the last 8 buyers and sellers.
It is recommended to use a hollow candle while using this script.
Ice Cream Volume Profile [Visible range]While exploring the new Pine Script feature, Polylines, I've created a fun project called the
Ice Cream Volume Profile for the visible range.
This fun project serves several purposes:
It displays the level at which the most trades (volume) occur.
It provides Delta volume information.
It counts how many times a bar closed within this level.
It assists in drawing support and resistance zones.
It aids in interpreting volume data.
The top part of the ice cream cone changes color as follows:
Green: When the bullish volume exceeds 55% of the total volume.
Red: When the bearish volume surpasses 55% of the total volume.
Yellow: When neither Green nor Red exceeds 55% of the total volume.
Polylines are an excellent feature that enables us to create even more intriguing visuals in Pine Script.
Zanger Volume Profile ZVR v1This is an attempt to make a zanger volume profile indicator, it needs improvement and some sort of forward looking volume estimator.
Rotation Factor: Buy/Sell Pressure for Market/Volume ProfileRotation Factor is a simple formula to figure out the buy and sell pressure of the overall day. Rotation Factor is usually combined with Market Profile or Volume Profile analysis. It is designed to be used on the 30min timeframe with a 1D interval reset. It can be used on other timeframes, but results will vary. Some Rotation Factor traders like to use it on a daily with a 1M interval reset for longer term trading.
The formula is very clean because it only focuses on price action, highs and lows. The formula is as follows:
Current Bar makes Higher High and Higher Low +2 points
Current Bar makes Lower High and Lower Low -2 Points
Current Bar makes Higher High and Lower Low 0 Points
Current Bar makes Lower High and Higher Low 0 Points
Current High and Previous High are Equal and Higher Low +1 Points
Current Bar makes Higher High but Current and Previous lows are equal +1 Points
Current Bar makes Lower High but Current and Previous lows are equal -1 Points
Current High and Previous High are Equal and Lower Low -1 Points
I hope you enjoy this indicator, if you have any questions let me know in the comments.
Poor man's volume profileThis is an attempt to get something more or less similar to the volume profile for free.
The code is generated using a template. To change the settings, you may need to regenerate the code. The code has a link to the repository with the template.
(SM3) Volume Profile Tool-kit1st pine script. It is a work in progress. I use this to mark previous day high and low value areas as well as overnight volume profile for NYSE open strategy.
Volume Profile: Intra-bar VolumeThis indicator was developed as part of a free blog post tutorial on the Backtest-Rookies website for detailed code commentary, head over there.
Scope
The indicator shall attempt to do the following:
Look at a lower time-frame. E.g 5 minutes when on a 1-hour chart.
Create a function to loop through through candles and make an assessment.
If the candle it closed up, the volume will be categorized as buying volume. Conversely, if it closed down, the volume will be categorized as selling volume
The function will then be passed to the security() function to run on a lower timeframe.
All buying volume and selling volume from the lower time-frame shall be summed and displayed on the main chart.
Important Note
This indicator will not give you genuine buying or selling volume. It simply follows the assumption that if price closed up, there must have been more buyers than sellers and if it closed down we assume the opposite.
Usage
In order to use this indicator, users will need to calculate how many lower time-frame bars are contained in the time-frame on the main chart. So for example, the default settings are configured for the indicator to be run on the 1H chart. As a result, we need to set the "Bars on Lower Timeframe" input to 12. This is because there are 12 x 5-minute bars in 60 minutes.
VP-Period with Previous Day Levels & Historical POC# Volume Profile with Previous Day Levels & Historical POCs
## Description
Comprehensive indicator combining Volume Profile analysis, previous day levels, and historical POC (Point of Control) levels for advanced technical analysis.
## Key Features
### Volume Profile
- **Customizable period**: 3 to 500 days
- **Calculation resolution**: 400 to 700 points
- **Current VPOC**: Point of Control line for current period
- **Volume bars**: graphical display of volume profile distribution
### Historical POCs
- **POC history**: up to 20 previous days
- **Time labels**: shows how many days ago for each POC
- **Dashed lines**: easy identification of historical levels
### Previous Day Levels (last 5 days)
- **High/Low**: daily highs and lows
- **Midpoint**: 50% level (High+Low)/2
- **Open/Close**: opening and closing prices
- **Progressive thickness**: day 1 thicker, decreasing for previous days
## Customization
- Fully configurable colors for each element
- Toggle on/off switches for every component
- Different line styles (solid, dashed, dotted)
## Usage
Perfect for traders using volume analysis and support/resistance based on previous daily levels. Ideal for identifying key zones and significant breakout points.
Volume Profile + Price Action Strategy (POC-based)This indicator combines volume dynamics, price action patterns, and a simplified Point of Control (POC) to highlight potential high-probability trade zones.
🔍 Key Features
POC-Based Logic
Plots the POC from the most recent closed 10-minute candle as a horizontal level for intraday structure.
Volume Spike Detection
Highlights unusual activity based on volume compared to the average of the last N candles.
Effort vs. Result Analysis
Based on Wyckoff-inspired logic:
Absorption: Large volume, small body → possible buyer/seller absorption
False Move: Small volume, large body → potential fakeout
Price Action Recognition Detects:
Inside Bars
Pin Bars
Engulfing Candles
Signal Highlights
🔺 Absorption Signals (below bar, teal triangle)
🔻 False Move Signals (above bar, orange triangle)
🔷 POC Line
⚙️ Customizable Inputs
You can control signal sensitivity with these inputs:
Volume Spike Multiplier
Raise to filter only extreme volume spikes
→ Recommended: 2.0 to 3.0 for cleaner setups
Absorption Body Ratio
Lower to detect only very small bodies (tight candles)
→ Try 0.3 to 0.4 for stricter absorption logic
False Move Body Ratio
Raise to catch only large candles on low volume
→ Use 2.0+ to filter weak moves
🧠 How to Use
Use in confluence with:
Support/Resistance
VWAP or moving averages
Session opens/closes
Best on 10-minute charts, but adjustable
✅ Signal Tuning Tips
Want fewer but cleaner signals?
Increase Volume Spike Multiplier: 2.5+
Decrease Absorption Body Ratio: 0.3
Increase False Move Ratio: 2.0+
Want more frequent signals?
Lower Volume Multiplier: 1.2–1.5
Raise Absorption Ratio: 0.6+
Lower False Move Ratio: 1.2–1.4
📊 Recommended Timeframe
Optimized for 10-minute charts
Works intraday, especially around session opens and POC re-tests
⚠️ Disclaimer
This script is for educational and informational purposes only. It does not constitute financial advice or a recommendation to buy or sell any asset. Past performance is not indicative of future results. Always do your own research and consult a licensed financial advisor before making trading decisions.
Use at your own risk.
Volume Profile Volume Delta OI Delta [Kioseff Trading]Hello!
This script serves to distinguish volume delta for any asset and open interest delta for Binance perpetual futures.
The image above provides further explanation of functionality and color correspondence.
The image above shows the indicator calculating volume at each tick level and displaying the metric.
The label color outline (neon effect) is configurable; the image above is absent the feature.
The image above shows Open Interest (OI) Delta calculated - similar to how the script calculates volume delta - for a Binance Perpetual Future pair.
This feature only works for Binance Futures pairs; the script will not load when trying to calculate OI Delta on other assets.
Additionally, a heatmap is displayable should you configure the indicator to calculate it.
The image above shows a heatmap using volume delta calculations.
The image above shows a heatmap using OI delta calculations.
Of course, these calculations - when absent requisite data - require some assumptions to better replicate calculations with access to requisite data.
The indicator assumes a 60/40 split when a tick level is traded at and only one metric - "buy volume" or "sell volume" is recorded. This means there shouldn't be any levels recorded where "buy volume" is greater than 0 and "sell volume" equals 0 and vice versa. While this assumption was performed arbitrarily, it may help better replicate volume delta and OI delta calculations seen on other charting platforms.
This option is configurable; you can select to have the script not assume a 60/40 split and instead record volume "as is" at the corresponding tick level.
The script also divides volume and open interest if a one-minute bar violates multiple tick levels. The volume or open interest generated on the one-minute bar will be divided by the number of tick levels it exceeds. The results are, subsequently, appended to the violated tick levels.
Further, the script can be set to recalculate after a user-defined time threshold is exceeded. You can also define the percentage or tick distance between levels.
Also, it'd be great if this indicator can nicely replicate volume delta indicators on other charting platforms. If you've any ideas on how price action can be used to better assume volume at the corresponding price area please let me know!
Thank you (:
Volume Profile S/R + OB/OS + BreaksAs a support resistance trader I have created this indicator that shows SR lines. RSI over bought and over sold. I also added momentum candle.
It's easy to use. The arrows show over bought and over sold, that's where I start to be interested. Confirmation is if we are near a support/resistance area. shown as a red/green line.
Don't just trade the RSI, Be patient and only take the perfekt setups.
I't clean, it's simple it works.
Volume Profile Bar-Magnified Order Blocks [JacobMagleby]djfkudfudgfdsfhdcjdgcgbkdcjbfsdhgfhgignhdghklgdlgdkgnhdghnfjknvlskvmjldkvmjlkfgmjlfgvjljm
Hoon Fib project//@version=6
indicator("Hoon Fib project", shorttitle ="Hoon Fib project" ,overlay = true, max_bars_back = 5000)
// ~~ Tooltips {
var string t1 = "Period:\nNumber of bars used to detect swing highs and swing lows. Larger values give fewer but larger swings. (Works relative to current timeframe)."
var string t2 = "Projection Level:\nFibonacci ratio used to calculate the projected future swing targets (e.g. 61.8%)."
var string t2_b = "Trend Projection Ratio:\nThe secondary Fibonacci ratio used for the furthest extension (default was 1.272)."
var string t3 = "Level 1:\nRatio and Color for the first retracement level (Standard: 0.236)."
var string t4 = "Level 2:\nRatio and Color for the second retracement level (Standard: 0.382)."
var string t5 = "Level 3:\nRatio and Color for the third retracement level (Standard: 0.500)."
var string t6 = "Level 4:\nRatio and Color for the fourth retracement level (Standard: 0.618)."
var string t7 = "Level 5:\nRatio and Color for the fifth retracement level (Standard: 0.786)."
var string t8 = "Fib Line Width:\nThickness of all horizontal Fibonacci retracement lines."
var string t9 = "Fib Labels:\nShow or hide percentage labels at each Fibonacci retracement line."
var string t10 = "Fib Label Text Color:\nText color of Fibonacci retracement labels."
var string t11 = "Fib Label Size:\nFont size of Fibonacci retracement labels."
var string t12 = "Low Line Color:\nColor for the most recent swing low horizontal guide line."
var string t13 = "High Line Color:\nColor for the most recent swing high horizontal guide line."
var string t14 = "Swing Line Width:\nThickness of both swing high and swing low guide lines."
var string t15 = "Fib Volume Profile:\nEnable or disable the main volume profile drawn between the last swing high and low."
var string t16 = "Rows:\nNumber of price rows (bins) used in the Fib volume profile. More rows = finer detail."
var string t17 = "Flip Bull/Bear:\nSwap the horizontal position of bullish and bearish volume bars in the profile."
var string t18 = "Bull Volume Color:\nBase color used for bullish (up-bar) volume in the Fib volume profile."
var string t19 = "Bear Volume Color:\nBase color used for bearish (down-bar) volume in the Fib volume profile."
var string t20 = "Fib Volume Delta:\nEnable or disable the separate volume delta profile between Fibonacci price bands."
var string t21 = "Delta Max Width:\nMaximum horizontal width (in bars) used to scale delta boxes from smallest to largest."
var string t22 = "Bullish Delta Color:\nFill color for bands where bullish volume exceeds bearish volume (positive delta)."
var string t23 = "Bearish Delta Color:\nFill color for bands where bearish volume exceeds bullish volume (negative delta)."
var string t24 = "Bullish Projection Line Color:\nColor of projected segments when price is projected upward."
var string t25 = "Bearish Projection Line Color:\nColor of projected segments when price is projected downward."
var string t26 = "Projection Line Width:\nThickness of projected swing segments."
var string t27 = "Projection Line Style:\nVisual style of projected lines (solid, dashed, dotted, or arrows)."
var string t28 = "Bullish Label Background:\nBackground color for percentage labels on upward projection segments."
var string t29 = "Bearish Label Background:\nBackground color for percentage labels on downward projection segments."
var string t30 = "Projection Label Text Color:\nText color of projection percentage labels."
var string t31 = "Projection Label Size:\nFont size of projection percentage labels."
var string t32 = "Projection Box Background:\nToggle the background fill of projection boxes on or off."
var string t33 = "Projection Box Background Color:\nFill color used for projection boxes (when background is enabled)."
var string t34 = "Projection Box Border:\nToggle drawing a border around projection boxes."
var string t35 = "Projection Box Border Color:\nColor of the border around projection boxes."
var string t36 = "Projection Box Border Width:\nThickness of projection box borders."
var string t37 = "Projection Box Border Style:\nLine style for projection box borders (solid/dashed/dotted)."
var string t38 = "Projection Box Horizontal Align:\nHorizontal alignment of text inside projection boxes (left/center/right)."
var string t39 = "Projection Box Vertical Align:\nVertical alignment of text inside projection boxes (top/center/bottom)."
var string t40 = "Projection Box Text Color:\nText color for the projection level values shown inside the boxes."
var string t41 = "Projection Box Text Size:\nFont size of the projection level values shown inside the boxes."
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
// ~~ Inputs {
prd = input.int(
100,
"Period",
group = "Fib Settings",
inline = "fibColor",
tooltip = t1
)
lvl = input.float(
0.618,
title = "Projection Level",
group = "Fib Settings",
options = ,
tooltip = t2
)
// NEW INPUT FOR CUSTOM FIB
trendFibbRatio = input.float(
1.272,
title = "Trend Projection Ratio",
step = 0.001,
group = "Fib Settings",
tooltip = t2_b
)
// Fib line style inputs (horizontal fib levels)
fibLvl1 = input.float(0.236, "Level 1", group = "Fib Levels Style", inline = "f1", tooltip = t3)
fibColor236 = input.color(#f23645, "", group = "Fib Levels Style", inline = "f1")
fibLvl2 = input.float(0.382, "Level 2", group = "Fib Levels Style", inline = "f2", tooltip = t4)
fibColor382 = input.color(#81c784, "", group = "Fib Levels Style", inline = "f2")
fibLvl3 = input.float(0.500, "Level 3", group = "Fib Levels Style", inline = "f3", tooltip = t5)
fibColor500 = input.color(#4caf50, "", group = "Fib Levels Style", inline = "f3")
fibLvl4 = input.float(0.618, "Level 4", group = "Fib Levels Style", inline = "f4", tooltip = t6)
fibColor618 = input.color(#089981, "", group = "Fib Levels Style", inline = "f4")
fibLvl5 = input.float(0.786, "Level 5", group = "Fib Levels Style", inline = "f5", tooltip = t7)
fibColor786 = input.color(#64b5f6, "", group = "Fib Levels Style", inline = "f5")
fibLineWidth = input.int(
2,
"Fib Line Width",
minval = 1,
maxval = 5,
group = "Fib Levels Style",
inline = "fwidth",
tooltip = t8
)
showlab = input.bool(
false,
title = "Fib Labels",
group = "Fib Levels Style",
inline = "fiblab"
)
fibLabelColor = input.color(
color.white,
"",
group = "Fib Levels Style",
inline = "fiblab"
)
fibLabelSizeStr = input.string(
"Small",
"",
options = ,
group = "Fib Levels Style",
inline = "fiblab",
tooltip = t9 + "\n\n" + t10 + "\n\n" + t11
)
fibLabelOffset = 1 // (fixed) x offset for labels
// derived label size
fibLabelSize =
fibLabelSizeStr == "Tiny" ? size.tiny :
fibLabelSizeStr == "Small" ? size.small :
fibLabelSizeStr == "Large" ? size.large :
fibLabelSizeStr == "Huge" ? size.huge :
size.normal
// Swing high/low lines
loLineColor = input.color(
color.new(color.green, 0),
"Low Line",
group = "Swing High/Low Lines Style",
inline = "hi"
)
hiLineColor = input.color(
color.new(color.red, 0),
"High Line",
group = "Swing High/Low Lines Style",
inline = "hi"
)
hiloLineWidth = input.int(
2,
"Width",
1,
5,
group = "Swing High/Low Lines Style",
inline = "hi",
tooltip = t12 + "\n\n" + t13 + "\n\n" + t14
)
// Fib volume profile inputs
showFibProfile = input.bool(
true,
"Fib Volume Profile",
group = "Fib Volume Profile",
inline = "fibprof"
)
rows = input.int(
10,
"Rows",
2,
100,
group = "Fib Volume Profile",
inline = "fibprof"
)
flipOrder = input.bool(
false,
"Flip Bull/Bear",
group = "Fib Volume Profile",
inline = "fibprof",
tooltip = t15 + "\n\n" + t16 + "\n\n" + t17
)
bull_color = input.color(
color.new(color.teal, 30),
"Bull",
group = "Fib Volume Profile",
inline = "volColor"
)
bear_color = input.color(
color.new(color.orange, 30),
"Bear",
group = "Fib Volume Profile",
inline = "volColor",
tooltip = t18 + "\n\n" + t19
)
// Volume Text Settings
showVolText = input.bool(true, "Show Volume Values", group="Fib Volume Profile", inline="vtxt")
volTextSizeStr = input.string("Tiny", "Size", options= , group="Fib Volume Profile", inline="vtxt")
volTextSize =
volTextSizeStr == "Tiny" ? size.tiny :
volTextSizeStr == "Small" ? size.small :
size.normal
// Fib Volume Delta profile
showFibDelta = input.bool(
false,
"Fib Volume Delta",
group = "Fib Volume Delta Profile",
inline = "delta"
)
deltaMaxWidth = input.int(
30,
"Max Width",
minval = 5,
maxval = 200,
group = "Fib Volume Delta Profile",
inline = "delta",
tooltip = t20 + "\n\n" + t21
)
deltaBullColor = input.color(
color.new(color.lime, 80),
"Bullish Delta",
group = "Fib Volume Delta Profile",
inline = "deltaColor"
)
deltaBearColor = input.color(
color.new(color.red, 80),
"Bearish Delta",
group = "Fib Volume Delta Profile",
inline = "deltaColor",
tooltip = t22 + "\n\n" + t23
)
// Projection LINES style
projLineBullColor = input.color(
color.new(color.green, 0),
"Bullish",
group = "Projection Lines Style",
inline = "plc"
)
projLineBearColor = input.color(
color.new(color.red, 0),
"Bearish",
group = "Projection Lines Style",
inline = "plc"
)
projLineWidth = input.int(
2,
"Width",
1,
5,
group = "Projection Lines Style",
inline = "plc"
)
projLineStyleStr = input.string(
"Arrow Right",
"",
options = ,
group = "Projection Lines Style",
inline = "plc",
tooltip = t24 + "\n\n" + t25 + "\n\n" + t26 + "\n\n" + t27
)
projLineStyle =
projLineStyleStr == "Solid" ? line.style_solid :
projLineStyleStr == "Dashed" ? line.style_dashed :
projLineStyleStr == "Dotted" ? line.style_dotted :
projLineStyleStr == "Arrow Left" ? line.style_arrow_left :
line.style_arrow_right
// Projection % LABELS style
projPercBullColor = input.color(
color.new(color.green, 0),
"Bullish Bg",
group = "Projection Labels Style",
inline = "plc"
)
projPercBearColor = input.color(
color.new(color.red, 0),
"Bearish Bg",
group = "Projection Labels Style",
inline = "plc"
)
projPercTextColor = input.color(
color.white,
"Text",
group = "Projection Labels Style",
inline = "plc"
)
projPercLabelSizeStr = input.string(
"Small",
"",
options = ,
group = "Projection Labels Style",
inline = "plc",
tooltip = t28 + "\n\n" + t29 + "\n\n" + t30 + "\n\n" + t31
)
projPercLabelSize =
projPercLabelSizeStr == "Tiny" ? size.tiny :
projPercLabelSizeStr == "Small" ? size.small :
projPercLabelSizeStr == "Large" ? size.large :
projPercLabelSizeStr == "Huge" ? size.huge :
size.normal
// Projection box style inputs
projBoxBgOn = input.bool(
true,
"Background",
group = "Projection Box Style",
inline = "pbg"
)
projBoxBgColor = input.color(
color.new(color.blue, 80),
"",
group = "Projection Box Style",
inline = "pbg"
)
projBoxBorderOn = input.bool(
true,
"Border",
group = "Projection Box Style",
inline = "pbg"
)
projBoxBorderCol = input.color(
color.new(color.white, 0),
"",
group = "Projection Box Style",
inline = "pbg"
)
projBoxBorderW = input.int(
1,
"",
minval = 1,
maxval = 5,
group = "Projection Box Style",
inline = "pbg"
)
projBoxBorderStyleStr = input.string(
"Solid",
"",
options = ,
group = "Projection Box Style",
inline = "pbg",
tooltip = t32 + "\n\n" + t33 + "\n\n" + t34 + "\n\n" + t35 + "\n\n" + t36 + "\n\n" + t37
)
projBoxTextHAlignStr = input.string(
"Center",
"H Align",
options = ,
group = "Projection Box Style",
inline = "ptxt"
)
projBoxTextVAlignStr = input.string(
"Center",
"V Align",
options = ,
group = "Projection Box Style",
inline = "ptxt",
tooltip = t38 + "\n\n" + t39
)
projBoxTextColor = input.color(
color.white,
"Text",
group = "Projection Box Style",
inline = "ptxt2"
)
projBoxTextSizeStr = input.string(
"Normal",
"",
options = ,
group = "Projection Box Style",
inline = "ptxt2",
tooltip = t40 + "\n\n" + t41
)
projBoxTextSize =
projBoxTextSizeStr == "Tiny" ? size.tiny :
projBoxTextSizeStr == "Small" ? size.small :
projBoxTextSizeStr == "Large" ? size.large :
projBoxTextSizeStr == "Huge" ? size.huge :
size.normal
// Derived projection box style settings
projBoxBorderStyle =
projBoxBorderStyleStr == "Solid" ? line.style_solid :
projBoxBorderStyleStr == "Dashed" ? line.style_dashed :
line.style_dotted
projBoxTextHAlign =
projBoxTextHAlignStr == "Left" ? "left" :
projBoxTextHAlignStr == "Right" ? "right" :
"center"
projBoxTextVAlign =
projBoxTextVAlignStr == "Top" ? "top" :
projBoxTextVAlignStr == "Bottom" ? "bottom" :
"center"
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
// ~~ Swing detection {
hi = ta.highest(high, prd)
lo = ta.lowest(low, prd)
isHi = high == hi
isLo = low == lo
HB = ta.barssince(isHi)
LB = ta.barssince(isLo)
// price of last swing high/low
hiPrice = ta.valuewhen(isHi, high, 0)
loPrice = ta.valuewhen(isLo, low, 0)
// bar index of last swing high/low
hiBar = ta.valuewhen(isHi, bar_index, 0)
loBar = ta.valuewhen(isLo, bar_index, 0)
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
// ~~ Persistent drawings {
var line hiLine = na
var line loLine = na
if barstate.isfirst
hiLine := line.new(na, na, na, na, color = hiLineColor, width = hiloLineWidth)
loLine := line.new(na, na, na, na, color = loLineColor, width = hiloLineWidth)
// arrays to store objects
var array fibbLines = array.new_line()
var array fibbLabels = array.new_label()
var array forecastLines = array.new_line()
var array areas = array.new_box()
var array perc = array.new_label()
var array fibProfileBoxes = array.new_box()
var array fibDeltaBoxes = array.new_box()
var int deltaStartX = na
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
// ~~ Functions {
// fib level calculator
fibbFunc(v, last, h, l) =>
last ? h - (h - l) * v : l + (h - l) * v
// generic cleaner for drawing-object arrays (lines, boxes, labels)
cleaner(a, idx) =>
if idx >= 0 and idx < array.size(a)
el = array.get(a, idx)
if not na(el)
el.delete()
array.remove(a, idx)
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
// ~~ Main logic {
if not na(HB) and not na(LB) and not na(hiPrice) and not na(loPrice) and not na(hiBar) and not na(loBar)
// update swing lines
// update swing lines (position + live style)
line.set_xy1(hiLine, hiBar, hiPrice)
line.set_xy2(hiLine, bar_index, hiPrice)
line.set_color(hiLine, hiLineColor)
line.set_width(hiLine, hiloLineWidth)
line.set_xy1(loLine, loBar, loPrice)
line.set_xy2(loLine, bar_index, loPrice)
line.set_color(loLine, loLineColor)
line.set_width(loLine, hiloLineWidth)
bars = math.abs(HB - LB)
// FIB retracement lines
for i = array.size(fibbLines) - 1 to 0
cleaner(fibbLines, i)
for i = array.size(fibbLabels) - 1 to 0
cleaner(fibbLabels, i)
lvls = array.from(fibLvl1, fibLvl2, fibLvl3, fibLvl4, fibLvl5)
cols = array.from(fibColor236, fibColor382, fibColor500, fibColor618, fibColor786)
baseOffset = HB > LB ? LB : HB
xFibStart = bar_index - baseOffset
for in lvls
f = fibbFunc(e, HB < LB, hiPrice, loPrice)
x1 = xFibStart
x2 = bar_index
ln = line.new(
chart.point.from_index(x1, f),
chart.point.from_index(x2, f),
color = cols.get(i),
width = fibLineWidth
)
array.push(fibbLines, ln)
// fib label at right of line
if showlab
fibText = str.tostring(e * 100, "#.##") + "%"
lbl = label.new(
chart.point.from_index(x2 + fibLabelOffset, f),
fibText,
textcolor = fibLabelColor,
style = label.style_label_left,
size = fibLabelSize,
color =cols.get(i)
)
array.push(fibbLabels, lbl)
// Projection part
fibb = fibbFunc(lvl, LB > HB, hiPrice, loPrice)
fibb2 = LB < HB ?
fibbFunc(lvl, true, fibb, loPrice) :
fibbFunc(lvl, false, hiPrice, fibb)
trendfibb = LB > HB ?
fibbFunc(trendFibbRatio, true, hiPrice, loPrice) :
fibbFunc(trendFibbRatio, false, hiPrice, loPrice)
forecast = array.from(HB < LB ? hiPrice : loPrice, fibb, fibb2, trendfibb)
segment = math.min(bars, math.floor(500.0 / 4.0))
// clear previous forecast lines, boxes, and labels
for i = array.size(forecastLines) - 1 to 0
cleaner(forecastLines, i)
for i = array.size(areas) - 1 to 0
cleaner(areas, i)
for i = array.size(perc) - 1 to 0
cleaner(perc, i)
deltaStartX := na
future = bar_index
for i = 0 to forecast.size() - 2
x1 = math.min(future, bar_index + 500)
x2 = math.min(future + segment, bar_index + 500)
y1 = forecast.get(i)
y2 = forecast.get(i + 1)
lnForecast = line.new(
x1, y1,
x2, y2,
color = y1 < y2 ? projLineBullColor : projLineBearColor,
width = projLineWidth,
style = projLineStyle
)
array.push(forecastLines, lnForecast)
// area box around the end of segment
midBoxLeft = x2 - math.round((x1 - x2) / 4.0)
midBoxRight = x2 + math.round((x1 - x2) / 4.0)
boxHeight = math.abs(y1 - y2) / 10.0
txtLevel = i == forecast.size() - 2 ?
str.tostring(trendFibbRatio, "#.###") :
str.tostring(lvl * 100, "#.##")
boxBg = projBoxBgOn ? projBoxBgColor : color.new(projBoxBgColor, 100)
boxBord = projBoxBorderOn ? projBoxBorderCol : color.new(projBoxBorderCol, 100)
bx = box.new(
midBoxLeft,
y2 + boxHeight,
midBoxRight,
y2 - boxHeight,
bgcolor = boxBg,
border_color = boxBord,
border_style = projBoxBorderStyle,
border_width = projBoxBorderW,
text = txtLevel,
text_halign = projBoxTextHAlign,
text_valign = projBoxTextVAlign,
text_color = projBoxTextColor,
text_size = projBoxTextSize
)
array.push(areas, bx)
// keep track of the rightmost edge of the last projection box
deltaStartX := na(deltaStartX) ? box.get_right(bx) : math.max(deltaStartX, box.get_right(bx))
// percentage label
change = (y2 - y1) / y1
midX = int(math.avg(x1, x2))
midY = line.get_price(lnForecast, midX)
lb = label.new(
chart.point.from_index(midX, midY),
str.tostring(change * 100, format.percent),
color = change > 0 ? projPercBullColor : projPercBearColor,
style = i == 1 ? label.style_label_lower_right : label.style_label_lower_left,
textcolor = projPercTextColor,
size = projPercLabelSize
)
array.push(perc, lb)
future += segment
// ~~ Fib Volume Profile
if showFibProfile and hiBar != loBar and not na(hiPrice) and not na(loPrice)
for i = array.size(fibProfileBoxes) - 1 to 0
cleaner(fibProfileBoxes, i)
top = math.max(hiPrice, loPrice)
bottom = math.min(hiPrice, loPrice)
if top != bottom
step = (top - bottom) / rows
levels = array.new_float()
for i = 0 to rows
array.push(levels, bottom + step * i)
volUp = array.new_float(rows, 0.0)
volDn = array.new_float(rows, 0.0)
startBar = math.min(hiBar, loBar)
endBar = math.max(hiBar, loBar)
for bi = startBar to endBar
offset = bar_index - bi
// SAFETY CHECK: Prevents crash on low timeframes if swing is > 5000 bars
if offset < 4998
price = hlc3
vol = nz(volume ) // SAFETY: nz() for no volume data
bull = close > open
for r = 0 to rows - 1
dn = array.get(levels, r)
up = array.get(levels, r + 1)
if price >= dn and price < up
if bull
array.set(volUp, r, array.get(volUp, r) + vol)
else
array.set(volDn, r, array.get(volDn, r) + vol)
break
maxTot = 0.0
for r = 0 to rows - 1
tot = array.get(volUp, r) + array.get(volDn, r)
maxTot := math.max(maxTot, tot)
span = endBar - startBar + 1
if maxTot > 0
for r = 0 to rows - 1
upVol = array.get(volUp, r)
dnVol = array.get(volDn, r)
normUp = upVol == 0 ? 0 : int((upVol / maxTot) * span)
normDn = dnVol == 0 ? 0 : int((dnVol / maxTot) * span)
bullRowCol = color.from_gradient(r, 0, rows - 1, color.new(bull_color, 80), color.new(bull_color, 10))
bearRowCol = color.from_gradient(r, 0, rows - 1, color.new(bear_color, 80), color.new(bear_color, 10))
yTop = array.get(levels, r + 1)
yBottom = array.get(levels, r)
leftBull = flipOrder ? startBar : startBar + normDn
rightBull = flipOrder ? startBar + normUp : startBar + normDn + normUp
leftBear = flipOrder ? startBar + normUp : startBar
rightBear = flipOrder ? startBar + normUp + normDn : startBar + normDn
if normUp > 0
bBull = box.new(
leftBull, yTop,
rightBull, yBottom,
bgcolor = bullRowCol,
border_color = color.new(bullRowCol, 0),
border_style = line.style_dotted,
text = showVolText ? str.tostring(upVol, format.volume) : "",
text_color = color.white,
text_size = volTextSize,
text_valign = text.align_center,
text_halign = text.align_center
)
array.push(fibProfileBoxes, bBull)
if normDn > 0
bBear = box.new(
leftBear, yTop,
rightBear, yBottom,
bgcolor = bearRowCol,
border_color = color.new(bearRowCol, 0),
border_style = line.style_dotted,
text = showVolText ? str.tostring(dnVol, format.volume) : "",
text_color = color.white,
text_size = volTextSize,
text_valign = text.align_center,
text_halign = text.align_center
)
array.push(fibProfileBoxes, bBear)
// Fib Volume Delta Profile
if showFibDelta and hiBar != loBar and not na(hiPrice) and not na(loPrice)
for i = array.size(fibDeltaBoxes) - 1 to 0
cleaner(fibDeltaBoxes, i)
// Build fib prices
fibPrices = array.new_float()
array.push(fibPrices, hiPrice)
for e in lvls
lvlPrice = fibbFunc(e, HB < LB, hiPrice, loPrice)
array.push(fibPrices, lvlPrice)
array.push(fibPrices, loPrice)
// Sort prices low→high
fibSorted = array.copy(fibPrices)
array.sort(fibSorted)
bandsCount = array.size(fibSorted) - 1
if bandsCount > 0
bandBull = array.new_float(bandsCount, 0.0)
bandBear = array.new_float(bandsCount, 0.0)
startBar = math.min(hiBar, loBar)
endBar = math.max(hiBar, loBar)
// accumulate bull/bear volume per band
for bi = startBar to endBar
offset = bar_index - bi
// SAFETY CHECK: Prevents crash on low timeframes if swing is > 5000 bars
if offset < 4998
price = hlc3
vol = nz(volume ) // SAFETY: nz()
bull = close > open
for b = 0 to bandsCount - 1
bandLow = array.get(fibSorted, b)
bandHigh = array.get(fibSorted, b + 1)
if price >= bandLow and price < bandHigh
if bull
array.set(bandBull, b, array.get(bandBull, b) + vol)
else
array.set(bandBear, b, array.get(bandBear, b) + vol)
break
// compute delta
maxAbsDelta = 0.0
for b = 0 to bandsCount - 1
delta = array.get(bandBull, b) - array.get(bandBear, b)
maxAbsDelta := math.max(maxAbsDelta, math.abs(delta))
if maxAbsDelta > 0
xStartBase = startBar
for b = 0 to bandsCount - 1
bandLow = array.get(fibSorted, b)
bandHigh = array.get(fibSorted, b + 1)
delta = array.get(bandBull, b) - array.get(bandBear, b)
if delta == 0
continue
absDelta = math.abs(delta)
widthBars = int((absDelta / maxAbsDelta) * deltaMaxWidth)
widthBars := math.max(widthBars, 1)
xEnd = xStartBase
xStart = xStartBase - widthBars
col = delta >= 0 ? deltaBullColor : deltaBearColor
dBox = box.new(
xStart, bandHigh,
xEnd, bandLow,
bgcolor = col,
border_color = color.new(col, 0),
border_style = line.style_solid,
text = "Δ " + str.tostring(delta, format.volume),
text_color = color.white,
text_halign = "center",
text_valign = "center"
)
array.push(fibDeltaBoxes, dBox)
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
Biller Project//@version=6
indicator("Hoon Fib Project", shorttitle ="Hoon Fib", overlay = true, max_bars_back = 5000)
// -----------------------------------------------------------------------------
// ~~ Tooltips & Constants
// -----------------------------------------------------------------------------
var string t1 = "Period:\nNumber of bars used to detect swing highs and swing lows."
var string t2 = "Projection Level:\nFibonacci ratio used to calculate the projected future targets."
var string t2_b = "Trend Projection Ratio:\nThe secondary Fibonacci ratio for extensions."
var string t15 = "Fib Volume Profile:\nEnable volume profile drawn between the last swing high and low."
var string t20 = "Fib Volume Delta:\nEnable volume delta profile between Fibonacci price bands."
// -----------------------------------------------------------------------------
// ~~ Inputs
// -----------------------------------------------------------------------------
// Group: General Settings
prd = input.int(100, "Period", group = "Fib Settings", tooltip = t1)
lvl = input.float(0.618, "Projection Level", options = , group = "Fib Settings", tooltip = t2)
trendFibbRatio = input.float(1.272, "Trend Projection Ratio", step = 0.001, group = "Fib Settings", tooltip = t2_b)
// Group: Fib Levels Style
fibLvl1 = input.float(0.236, "Level 1", group = "Fib Levels Style", inline = "f1")
fibColor236 = input.color(#f23645, "", group = "Fib Levels Style", inline = "f1")
fibLvl2 = input.float(0.382, "Level 2", group = "Fib Levels Style", inline = "f2")
fibColor382 = input.color(#81c784, "", group = "Fib Levels Style", inline = "f2")
fibLvl3 = input.float(0.500, "Level 3", group = "Fib Levels Style", inline = "f3")
fibColor500 = input.color(#4caf50, "", group = "Fib Levels Style", inline = "f3")
fibLvl4 = input.float(0.618, "Level 4", group = "Fib Levels Style", inline = "f4")
fibColor618 = input.color(#089981, "", group = "Fib Levels Style", inline = "f4")
fibLvl5 = input.float(0.786, "Level 5", group = "Fib Levels Style", inline = "f5")
fibColor786 = input.color(#64b5f6, "", group = "Fib Levels Style", inline = "f5")
// Golden Pocket - FIXED COLOR HERE
showGP = input.bool(true, "Show Golden Pocket (0.65)", group = "Fib Levels Style")
gpColor = input.color(color.new(#FFD700, 85), "GP Color", group = "Fib Levels Style")
fibLineWidth = input.int(2, "Fib Line Width", minval = 1, maxval = 5, group = "Fib Levels Style")
showlab = input.bool(true, "Show Labels", group = "Fib Levels Style", inline = "fiblab")
fibLabelColor = input.color(color.white, "Text Color", group = "Fib Levels Style", inline = "fiblab")
fibLabelSizeStr = input.string("Small", "Size", options = , group = "Fib Levels Style", inline = "fiblab")
fibLabelSize = switch fibLabelSizeStr
"Tiny" => size.tiny
"Small" => size.small
"Large" => size.large
=> size.normal
// Group: Swing High/Low Lines
loLineColor = input.color(color.new(color.green, 0), "Low Line", group = "Swing High/Low Lines Style", inline = "hi")
hiLineColor = input.color(color.new(color.red, 0), "High Line", group = "Swing High/Low Lines Style", inline = "hi")
hiloLineWidth = input.int(2, "Width", 1, 5, group = "Swing High/Low Lines Style", inline = "hi")
// Group: Fib Volume Profile
showFibProfile = input.bool(true, "Show Volume Profile", group = "Fib Volume Profile", tooltip = t15)
rows = input.int(24, "Rows", 2, 100, group = "Fib Volume Profile")
flipOrder = input.bool(false, "Flip Bull/Bear", group = "Fib Volume Profile")
bull_color = input.color(color.new(color.teal, 30), "Bull Vol", group = "Fib Volume Profile", inline = "volColor")
bear_color = input.color(color.new(color.orange, 30), "Bear Vol", group = "Fib Volume Profile", inline = "volColor")
showVolText = input.bool(true, "Show Values", group = "Fib Volume Profile", inline = "vtxt")
// Point of Control (POC)
showPOC = input.bool(true, "Show POC Line", group = "Fib Volume Profile")
pocColor = input.color(color.yellow, "POC Color", group = "Fib Volume Profile")
// Group: Fib Volume Delta
showFibDelta = input.bool(false, "Show Volume Delta", group = "Fib Volume Delta Profile", tooltip = t20)
deltaMaxWidth = input.int(30, "Max Width (Bars)", minval = 5, maxval = 200, group = "Fib Volume Delta Profile")
deltaBullColor = input.color(color.new(color.lime, 80), "Bull Delta", group = "Fib Volume Delta Profile", inline = "dc")
deltaBearColor = input.color(color.new(color.red, 80), "Bear Delta", group = "Fib Volume Delta Profile", inline = "dc")
// Group: Projection Style
projLineBullColor = input.color(color.new(color.green, 0), "Proj Bull", group = "Projection Style", inline = "plc")
projLineBearColor = input.color(color.new(color.red, 0), "Proj Bear", group = "Projection Style", inline = "plc")
projLineWidth = input.int(2, "Width", 1, 5, group = "Projection Style", inline = "plc")
projLineStyleStr = input.string("Arrow Right", "Style", options = , group = "Projection Style")
projLineStyle = switch projLineStyleStr
"Solid" => line.style_solid
"Dashed" => line.style_dashed
"Dotted" => line.style_dotted
=> line.style_arrow_right
// Group: Projection Box
projBoxBgOn = input.bool(true, "Box Bg", group = "Projection Box Style", inline = "pbg")
projBoxBgColor = input.color(color.new(color.blue, 80), "", group = "Projection Box Style", inline = "pbg")
projBoxTextColor = input.color(color.white, "Text", group = "Projection Box Style", inline = "pbg")
// NEW: Biller's Info Box Inputs
showBillerBox = input.bool(true, "Show Biller's Insight", group = "Biller's Insight")
billerPos = input.string("Top Right", "Position", options = , group = "Biller's Insight")
// -----------------------------------------------------------------------------
// ~~ Calculations
// -----------------------------------------------------------------------------
// Swing detection
hi = ta.highest(high, prd)
lo = ta.lowest(low, prd)
isHi = high == hi
isLo = low == lo
HB = ta.barssince(isHi)
LB = ta.barssince(isLo)
hiPrice = ta.valuewhen(isHi, high, 0)
loPrice = ta.valuewhen(isLo, low, 0)
hiBar = ta.valuewhen(isHi, bar_index, 0)
loBar = ta.valuewhen(isLo, bar_index, 0)
// Persistent Drawing Objects
var line hiLine = line.new(na, na, na, na, color = hiLineColor, width = hiloLineWidth)
var line loLine = line.new(na, na, na, na, color = loLineColor, width = hiloLineWidth)
var array fibbLines = array.new_line()
var array fibbLabels = array.new_label()
var array gpBoxes = array.new_box()
var array forecastLines = array.new_line()
var array areas = array.new_box()
var array perc = array.new_label()
var array fibProfileBoxes = array.new_box()
var array pocLines = array.new_line()
var array fibDeltaBoxes = array.new_box()
// Helper Functions
fibbFunc(v, last, h, l) => last ? h - (h - l) * v : l + (h - l) * v
cleaner(a, idx) =>
if idx >= 0 and idx < array.size(a)
el = array.get(a, idx)
if not na(el)
el.delete()
array.remove(a, idx)
// -----------------------------------------------------------------------------
// ~~ Logic Execution
// -----------------------------------------------------------------------------
if not na(HB) and not na(LB) and not na(hiPrice) and not na(loPrice)
// 1. Update Swing High/Low Lines
line.set_xy1(hiLine, hiBar, hiPrice)
line.set_xy2(hiLine, bar_index, hiPrice)
line.set_color(hiLine, hiLineColor)
line.set_xy1(loLine, loBar, loPrice)
line.set_xy2(loLine, bar_index, loPrice)
line.set_color(loLine, loLineColor)
// 2. Clear old drawings
while array.size(fibbLines) > 0
cleaner(fibbLines, 0)
while array.size(fibbLabels) > 0
cleaner(fibbLabels, 0)
while array.size(gpBoxes) > 0
cleaner(gpBoxes, 0)
while array.size(forecastLines) > 0
cleaner(forecastLines, 0)
while array.size(areas) > 0
cleaner(areas, 0)
while array.size(perc) > 0
cleaner(perc, 0)
// 3. Draw Fib Retracements
lvls = array.from(fibLvl1, fibLvl2, fibLvl3, fibLvl4, fibLvl5)
cols = array.from(fibColor236, fibColor382, fibColor500, fibColor618, fibColor786)
baseOffset = HB > LB ? LB : HB
xFibStart = bar_index - baseOffset
// Golden Pocket Logic
if showGP
gp618 = fibbFunc(0.618, HB < LB, hiPrice, loPrice)
gp65 = fibbFunc(0.65, HB < LB, hiPrice, loPrice)
gpBox = box.new(xFibStart, gp618, bar_index + 5, gp65, bgcolor = gpColor, border_color = na)
array.push(gpBoxes, gpBox)
for in lvls
f = fibbFunc(e, HB < LB, hiPrice, loPrice)
ln = line.new(xFibStart, f, bar_index, f, color = cols.get(i), width = fibLineWidth)
array.push(fibbLines, ln)
if showlab
lbl = label.new(bar_index + 1, f, str.tostring(e * 100, "#.##") + "%",
textcolor = fibLabelColor, style = label.style_label_left, size = fibLabelSize, color = cols.get(i))
array.push(fibbLabels, lbl)
// 4. Draw Projections
bars = math.abs(HB - LB)
fibb = fibbFunc(lvl, LB > HB, hiPrice, loPrice)
fibb2 = LB < HB ? fibbFunc(lvl, true, fibb, loPrice) : fibbFunc(lvl, false, hiPrice, fibb)
trendfibb = LB > HB ? fibbFunc(trendFibbRatio, true, hiPrice, loPrice) : fibbFunc(trendFibbRatio, false, hiPrice, loPrice)
forecast = array.from(HB < LB ? hiPrice : loPrice, fibb, fibb2, trendfibb)
segment = math.min(bars, math.floor(500.0 / 4.0))
future = bar_index
for i = 0 to forecast.size() - 2
y1 = forecast.get(i)
y2 = forecast.get(i + 1)
x2 = math.min(future + segment, bar_index + 500)
// Draw Projection Line
lnForecast = line.new(future, y1, x2, y2, color = y1 < y2 ? projLineBullColor : projLineBearColor, width = projLineWidth, style = projLineStyle)
array.push(forecastLines, lnForecast)
// Draw Target Box
midBoxLeft = x2 - math.round((future - x2) / 4.0)
txtLevel = i == forecast.size() - 2 ? str.tostring(trendFibbRatio, "#.###") : str.tostring(lvl * 100, "#.##")
boxHeight = math.abs(y1 - y2) / 10.0
bx = box.new(midBoxLeft, y2 + boxHeight, x2 + math.round((future - x2) / 4.0), y2 - boxHeight,
bgcolor = projBoxBgOn ? projBoxBgColor : na, border_width = 1,
text = txtLevel, text_color = projBoxTextColor)
array.push(areas, bx)
future += segment
// 5. Volume Profile Logic
if showFibProfile and hiBar != loBar
while array.size(fibProfileBoxes) > 0
cleaner(fibProfileBoxes, 0)
while array.size(pocLines) > 0
cleaner(pocLines, 0)
top = math.max(hiPrice, loPrice)
bottom = math.min(hiPrice, loPrice)
step = (top - bottom) / rows
// Define bins
volUp = array.new_float(rows, 0.0)
volDn = array.new_float(rows, 0.0)
startBar = math.min(hiBar, loBar)
endBar = math.max(hiBar, loBar)
for bi = startBar to endBar
offset = bar_index - bi
if offset < 4999
p = hlc3
v = nz(volume )
isBull = close > open
// Find correct bin
if p >= bottom and p <= top
idx = int((p - bottom) / step)
idx := math.min(idx, rows - 1)
if isBull
array.set(volUp, idx, array.get(volUp, idx) + v)
else
array.set(volDn, idx, array.get(volDn, idx) + v)
// Draw Volume Boxes and Calc POC
maxTot = 0.0
maxTotIdx = 0 // Track index of max volume
for i = 0 to rows - 1
tot = array.get(volUp, i) + array.get(volDn, i)
if tot > maxTot
maxTot := tot
maxTotIdx := i
span = endBar - startBar + 1
blendTxtColor = color.new(color.white, 30)
minWidthForText = 2
if maxTot > 0
for r = 0 to rows - 1
upV = array.get(volUp, r)
dnV = array.get(volDn, r)
if upV + dnV > 0
normUp = int((upV / maxTot) * span)
normDn = int((dnV / maxTot) * span)
yTop = bottom + step * (r + 1)
yBot = bottom + step * r
// Draw Bull Box
if normUp > 0
txtBull = (showVolText and normUp > minWidthForText) ? str.tostring(upV, format.volume) : ""
bxBull = box.new(startBar + (flipOrder ? 0 : normDn), yTop, startBar + (flipOrder ? normUp : normUp + normDn), yBot,
bgcolor = bull_color, border_style = line.style_dotted, border_color = color.new(bull_color, 50),
text = txtBull, text_color = blendTxtColor, text_size = size.tiny, text_halign = text.align_center, text_valign = text.align_center)
array.push(fibProfileBoxes, bxBull)
// Draw Bear Box
if normDn > 0
txtBear = (showVolText and normDn > minWidthForText) ? str.tostring(dnV, format.volume) : ""
bxBear = box.new(startBar + (flipOrder ? normUp : 0), yTop, startBar + (flipOrder ? normUp + normDn : normDn), yBot,
bgcolor = bear_color, border_style = line.style_dotted, border_color = color.new(bear_color, 50),
text = txtBear, text_color = blendTxtColor, text_size = size.tiny, text_halign = text.align_center, text_valign = text.align_center)
array.push(fibProfileBoxes, bxBear)
// Draw POC Line
if showPOC
pocY = bottom + step * (maxTotIdx + 0.5) // Midpoint of max bin
pocLn = line.new(startBar, pocY, bar_index + 10, pocY, color = pocColor, width = 2, style = line.style_solid)
array.push(pocLines, pocLn)
// 6. Volume Delta Logic
if showFibDelta and hiBar != loBar
while array.size(fibDeltaBoxes) > 0
cleaner(fibDeltaBoxes, 0)
fibPrices = array.new_float()
array.push(fibPrices, hiPrice)
array.push(fibPrices, loPrice)
for e in lvls
array.push(fibPrices, fibbFunc(e, HB < LB, hiPrice, loPrice))
array.sort(fibPrices)
bandsCount = array.size(fibPrices) - 1
bandBull = array.new_float(bandsCount, 0.0)
bandBear = array.new_float(bandsCount, 0.0)
startBar = math.min(hiBar, loBar)
endBar = math.max(hiBar, loBar)
for bi = startBar to endBar
offset = bar_index - bi
if offset < 4999
p = hlc3
v = nz(volume )
isBull = close > open
for b = 0 to bandsCount - 1
bLow = array.get(fibPrices, b)
bHigh = array.get(fibPrices, b + 1)
if p >= bLow and p < bHigh
if isBull
array.set(bandBull, b, array.get(bandBull, b) + v)
else
array.set(bandBear, b, array.get(bandBear, b) + v)
break
maxAbsDelta = 0.0
for b = 0 to bandsCount - 1
maxAbsDelta := math.max(maxAbsDelta, math.abs(array.get(bandBull, b) - array.get(bandBear, b)))
if maxAbsDelta > 0
for b = 0 to bandsCount - 1
delta = array.get(bandBull, b) - array.get(bandBear, b)
if delta != 0
widthBars = int((math.abs(delta) / maxAbsDelta) * deltaMaxWidth)
widthBars := math.max(widthBars, 1)
col = delta >= 0 ? deltaBullColor : deltaBearColor
dBox = box.new(startBar - widthBars, array.get(fibPrices, b+1), startBar, array.get(fibPrices, b),
bgcolor = col, border_color = na,
text = "Δ " + str.tostring(delta, format.volume), text_color = color.new(color.white, 20), text_size = size.small)
array.push(fibDeltaBoxes, dBox)
// -----------------------------------------------------------------------------
// ~~ Biller's Info Box Logic
// -----------------------------------------------------------------------------
var table infoTable = table.new(
position = billerPos == "Top Right" ? position.top_right : billerPos == "Bottom Right" ? position.bottom_right : billerPos == "Bottom Left" ? position.bottom_left : position.top_left,
columns = 1,
rows = 3,
bgcolor = color.new(color.black, 40),
border_width = 1,
border_color = color.new(color.white, 80)
)
if showBillerBox and barstate.islast
// Determine Bias: If the last Pivot was a LOW (LB < HB), market is technically trending UP from that low.
bool isBullish = LB < HB
string biasTitle = isBullish ? "🐂 BULLISH BIAS" : "🐻 BEARISH BIAS"
color biasColor = isBullish ? color.new(color.green, 20) : color.new(color.red, 20)
string biasMsg = isBullish ? "Don't look for shorts, Biller!" : "Don't look for longs, Biller!"
// Array of Quotes
string quotes = array.from(
"Biller, you're not gonna pass ur eval looking at the chart all day.",
"Fuck it, go in. I believe in u.",
"Trust JD's Signals.",
"Scared money makes no money, Biller.",
"Evaluation is just a mindset.",
"JD is watching... don't fumble.",
"Are you really gonna take that trade?",
"Wait for the setup, Biller.",
"Don't be a liquidity exit, Biller."
)
int quoteIdx = bar_index % array.size(quotes)
string currentQuote = array.get(quotes, quoteIdx)
// Row 1: Bias Header
table.cell(infoTable, 0, 0, biasTitle, bgcolor = biasColor, text_color = color.white, text_size = size.normal)
// Row 2: Instruction
table.cell(infoTable, 0, 1, biasMsg, text_color = color.white, text_size = size.small)
// Row 3: Motivation/Quote
table.cell(infoTable, 0, 2, "\"" + currentQuote + "\"", text_color = color.yellow, text_size = size.small, text_halign = text.align_center)






















